/*
 * DCF77.h
 *
 *  Created on: 22.09.2011
 *      Author: windows97
 */

#ifndef DCF77_H_
#define DCF77_H_

typedef struct _T_DCF77 {
  unsigned char M :1;
  unsigned char O1 :1;
  unsigned char O2 :1;
  unsigned char O3 :1;
  unsigned char O4 :1;
  unsigned char O5 :1;
  unsigned char O6 :1;
  unsigned char O7 :1;
  unsigned char O8 :1;
  unsigned char O9 :1;
  unsigned char O10 :1;
  unsigned char O11 :1;
  unsigned char O12 :1;
  unsigned char O13 :1;
  unsigned char O14 :1;
  unsigned char R :1;
  unsigned char A1 :1;
  unsigned char Z1 :1;
  unsigned char Z2 :1;
  unsigned char A2 :1;
  unsigned char S :1;
  unsigned char Min :7;//7 Bits for minutes
  unsigned char P1 :1;//Parity minutes
  unsigned char Hour :6;//6 Bits for hours
  unsigned char P2 :1;//Parity hours
  unsigned char Day :6;//6 Bits for day
  unsigned char Weekday :3;//3 Bits for weekday
  unsigned char Month :5;//3 Bits for month
  unsigned char Year :8;//8 Bits for year **a 5 for year 2005**
  unsigned char P3 :1;//Parity of P2
} T_DCF77;

typedef struct _T_DCF77_FLAGS
{
  uint8_t Partity1:1;
  uint8_t Partity2:1;
  uint8_t Partity3:1;
  uint8_t PartityError:1;
  uint8_t Sync:1;
  uint8_t unused:4;
} T_DCF77Flags;

#define DCF77_PULSEHIGH_LENGTH 6

void DcfInit( void );
uint8_t DcfGetSyncState( void );
void DcfGetSignal( T_DCF77 *iDcfSignal );


#endif /* DCF77_H_ */
